using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sec_scan漏洞扫描系统.Sec_Api
{
    public class Sec_AllAPI
    {
        /// <summary>
        /// 所有连接sql数据库的通用方法
        /// </summary>
        /// <param name="sqlc"></param>
        /// <returns></returns>
        public static string Sqlclient(string sqlc)
        {
            sqlc = "data source=Sec_DbConfig/Sec_LoopScanSystem.db";
            return sqlc;
        }
        /// <summary>
        /// 加载系统账号密码SQL语句
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        public static string UserRefer(string update)
        {
            update = "SELECT ID, sec_user, sec_password, sec_addtime FROM Sec_Admin";
            return update;
        }
        /// <summary>
        /// 加载漏洞数据库
        /// </summary>
        /// <param name="loop"></param>
        /// <returns></returns>
        public static string LoopInfo(string loop)
        {
            loop = "SELECT ID, sec_loopname, sec_looppayload, sec_loopkeyword, sec_loopaddr, sec_looptype, sec_looplevel, sec_loopnumber, sec_cnvd, sec_cnnvd, sec_cve, sec_revise, sec_accuracy, sec_addtime FROM Sec_LoopDetails";
            return loop;
        }
        /// <summary>
        /// 加载独立的漏洞数据库
        /// </summary>
        /// <param name="loop"></param>
        /// <returns></returns>
        public static string LoopInfos(string loop)
        {
            loop = "SELECT ID, sec_loopname, sec_looppayload, sec_looptype,sec_accuracy, sec_addtime FROM Sec_LoopDetails";
            return loop;
        }
        /// <summary>
        /// 加载端口扫描配置
        /// </summary>
        /// <param name="dispose"></param>
        /// <returns></returns>
        public static string PortScanDispose(string dispose)
        {
            dispose = "SELECT ID, port, portnoite, addtime FROM Sec_PortScan_Dispose";
            return dispose;
        }
        /// <summary>
        /// 加载破解的密码
        /// </summary>
        /// <param name="crack"></param>
        /// <returns></returns>
        public static string SqlPassWordCrack(string crack)
        {
            crack = "SELECT ID, mysql, msssql, oracle, postgres, mongodb, linux, ftp, db2, maria, cache, clickhouse, cloudera, cookroachdb, cubrid, denodo, dremio, edb, greenplum, h2server, hana, hsql, informix, ingres, windows, uptime FROM Sec_SqlPassWord_Crack";
            return crack;
        }
        /// <summary>
        /// 查询指纹数据库
        /// </summary>
        /// <param name="finge"></param>
        /// <returns></returns>
        public static string FingeInfo(string finge)
        {
            finge = "SELECT ID, fingepath, fingekey, fingename, fingewafname, fingewafkey, fingewafform, fingeip, systemname, systemversion, systemtype, testaddress, addtime FROM Sec_FingerPrint";
            return finge;
        }
        /// <summary>
        /// 查询指纹数据库指纹的方法 不包含指纹waf
        /// </summary>
        /// <param name="finge"></param>
        /// <returns></returns>
        public static string FingeInfos(string finge)
        {
            finge = "SELECT ID, fingepath, fingekey, fingename, fingeip, systemname, systemversion, systemtype,addtime FROM Sec_FingerPrint";
            return finge;
        }
        /// <summary>
        /// 加载扫描配置
        /// </summary>
        /// <param name="scanstring"></param>
        /// <returns></returns>
        public static string ScanSeetring(string scanstring)
        {
            scanstring = "SELECT ID, info, adminscan, domainscan, loopscan, fingerscan, mentinfo, sqlinfo, systeminfo, portinfo, noinfo, allport, pointport, scantype, updata FROM Sec_Scan_Seetring";
            return scanstring;
        }
        /// <summary>
        /// 加载密码爆破配置
        /// </summary>
        /// <param name="pass"></param>
        /// <returns></returns>
        public static string PassCrack(string pass)
        {
            pass = "SELECT ID, mysql, msssql, oracle, postgres, mongodb, db2, mariadb, cache, clickhouse, cloudera, cookroachdb, cubrid, denodo, dremio, edb, greenplum, h2server, hana, hsql, informix, ingres, linux, windows, ftp, uptime FROM Sec_PassCrack_Seetring";
            return pass;
        }
        /// <summary>
        /// mysql 密码数据查询sql
        /// </summary>
        /// <param name="mysql"></param>
        /// <returns></returns>
        public static string MysqlPass(string mysql)
        {
            mysql = "SELECT mysql FROM Sec_SqlPassWord_Crack";
            return mysql;
        }
        /// <summary>
        /// MSSSQL 密码数据查询sql
        /// </summary>
        /// <param name="msssql"></param>
        /// <returns></returns>
        public static string MsssqlPass(string msssql)
        {
            msssql = "SELECT msssql FROM Sec_SqlPassWord_Crack";
            return msssql;
        }
        /// <summary>
        /// oracle 密码数据查询sql
        /// </summary>
        /// <param name="oracle"></param>
        /// <returns></returns>
        public static string OraclePass(string oracle)
        {
            oracle = "SELECT oracle FROM Sec_SqlPassWord_Crack";
            return oracle;
        }
        /// <summary>
        /// postgres 密码数据查询sql
        /// </summary>
        /// <param name="postgres"></param>
        /// <returns></returns>
        public static string PostGresPass(string postgres)
        {
            postgres = "SELECT postgres FROM Sec_SqlPassWord_Crack";
            return postgres;
        }
        /// <summary>
        /// mongodb 密码数据查询sql
        /// </summary>
        /// <param name="mongodb"></param>
        /// <returns></returns>
        public static string MongoDbPass(string mongodb)
        {
            mongodb = "SELECT mongodb FROM Sec_SqlPassWord_Crack";
            return mongodb;
        }
        /// <summary>
        /// linux 密码数据查询sql
        /// </summary>
        /// <param name="linux"></param>
        /// <returns></returns>
        public static string LinuxPass(string linux)
        {
            linux = "SELECT linux FROM Sec_SqlPassWord_Crack";
            return linux;
        }
        /// <summary>
        /// windows 密码数据查询sql
        /// </summary>
        /// <param name="ftp"></param>
        /// <returns></returns>
        public static string FtpPass(string ftp)
        {
            ftp = "SELECT ftp FROM Sec_SqlPassWord_Crack";
            return ftp;
        }
        /// <summary>
        /// db2 密码数据查询sql
        /// </summary>
        /// <param name="db2"></param>
        /// <returns></returns>
        public static string Db2Pass(string db2)
        {
            db2 = "SELECT db2 FROM Sec_SqlPassWord_Crack";
            return db2;
        }
        /// <summary>
        /// maria 密码数据查询sql
        /// </summary>
        /// <param name="maria"></param>
        /// <returns></returns>
        public static string MariaPass(string maria)
        {
            maria = "SELECT maria FROM Sec_SqlPassWord_Crack";
            return maria;
        }
        /// <summary>
        /// cache 数据库 全称： intersystems iris
        /// </summary>
        /// <param name="cache"></param>
        /// <returns></returns>
        public static string CachePass(string cache)
        {
            cache = "SELECT cache FROM Sec_SqlPassWord_Crack";
            return cache;
        }
        /// <summary>
        /// ClickHouse 数据库查询
        /// </summary>
        /// <param name="click"></param>
        /// <returns></returns>
        public static string ClickHouse(string click)
        {
            click = "SELECT clickhouse FROM Sec_SqlPassWord_Crack";
            return click;
        }
        /// <summary>
        /// cloudera 数据库查询
        /// </summary>
        /// <param name="cloud"></param>
        /// <returns></returns>
        public static string Cloudera(string cloud)
        {
            cloud = "SELECT cloudera FROM Sec_SqlPassWord_Crack";
            return cloud;
        }
        /// <summary>
        /// CookRoachdb 数据库查询
        /// </summary>
        /// <param name="cook"></param>
        /// <returns></returns>
        public static string CookRoachdb(string cook)
        {
            cook = "SELECT cookroachdb FROM Sec_SqlPassWord_Crack";
            return cook;
        }
        /// <summary>
        /// 统计漏洞总数
        /// </summary>
        /// <param name="tics"></param>
        /// <returns></returns>
        public static string PocStatistics(string tics)
        {
            tics = "SELECT ID FROM Sec_LoopDetails";
            return tics;
        }
        /// <summary>
        /// 统计关键词总数
        /// </summary>
        /// <param name="tics"></param>
        /// <returns></returns>
        public static string WordStatistics(string word)
        {
            word = "SELECT ID, common, gov, edu, water, other FROM Sec_KeyWords";
            return word;
        }
        /// <summary>
        /// 统计密码总数
        /// </summary>
        /// <param name="pass"></param>
        /// <returns></returns>
        public static string PassStatistics(string pass)
        {
            pass = "SELECT ID FROM Sec_SqlPassWord_Crack";
            return pass;
        }
        /// <summary>
        /// 项目总数统计
        /// </summary>
        /// <param name="pass"></param>
        /// <returns></returns>
        public static string ProjectStatistics(string pro)
        {
            pro = "SELECT ID FROM Sec_ProjectAddInfo";
            return pro;
        }
        /// <summary>
        /// 查询指纹数据库
        /// </summary>
        /// <param name="finger"></param>
        /// <returns></returns>
        public static string FingerInfos(string finger)
        {
            finger = "SELECT ID, fingepath, fingekey, fingename, fingewafname, fingewafkey, fingewafform, fingeip, systemname, systemversion, systemtype, testaddress, addtime, code FROM Sec_FingerPrint";
            return finger;
        }
        /// <summary>
        /// 后台扫描地址
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string PathInfos(string path)
        {
            path = "SELECT dic FROM Sec_backstage";
            return path;
        }
    }
}
